import os

import img2pdf


def imageToPdfM():
    with open("output.pdf", "wb") as file:
        file.write(img2pdf.convert([i for i in os.listdir('img') if i.endswith(".png")]))


if __name__ == '__main__':
    # imageToPdfM()
    listPath = []
    for i in os.listdir('img'):
        p = os.path.join('img', i)
        listPath.append(p)
    with open("output.pdf", "wb") as file:
        file.write(img2pdf.convert(listPath))
